package com.yonyou.cyxdms.basedata.service.repository.questionaire;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yonyou.cyx.framework.dao.base.SuperMapper;
import com.yonyou.cyxdms.basedata.client.domains.vo.AnswerVisitUsedVO;
import com.yonyou.cyxdms.basedata.client.domains.vo.CareQuestionVO;
import com.yonyou.cyxdms.basedata.client.domains.vo.QuestionVisitInfoVO;
import com.yonyou.cyxdms.basedata.service.dto.questionaire.QueryAnswerDTO;
import com.yonyou.cyxdms.basedata.service.entity.questionaire.QuestionnairePO;
import com.yonyou.cyxdms.basedata.service.vo.questionaire.AnswerVO;
import com.yonyou.cyxdms.basedata.service.vo.questionaire.QuestionInfoVO;
import com.yonyou.cyxdms.basedata.service.vo.questionaire.QuestionnaireInVO;
import com.yonyou.cyxdms.basedata.service.vo.questionaire.QuestionnaireInfoVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 问卷 Mapper 接口
 * </p>
 *
 * @author renwd
 * @since 2019-09-19
 */
public interface QuestionnaireMapper extends SuperMapper<QuestionnairePO> {

    List<QuestionnaireInfoVO> queryQuestionnaire(Page<QuestionnaireInfoVO> page,  @Param("params")QueryAnswerDTO queryAnswerDTO);

    List<Long> selectQuestionRelation(@Param("questionnaireId")Long questionnaireId,@Param("questionId") Long questionId);

    List<Long> selectQuestionnaireName(@Param("appId")String appId, @Param("ownerCode")String ownerCode, @Param("questionnaireId")Long questionnaireId,@Param("questionnaireName")String questionnaireName);

    List<QuestionInfoVO> queryQuestionByQuestionnaireId(Page<QuestionInfoVO> page,@Param("questionnaireId") Long questionnaireId);

    List<QuestionnaireInVO> queryQuestionnaireByType(@Param("questionnaireType")String questionnaireType, @Param("isValid")Integer isValid,@Param("appId")String appId,@Param("ownerCode")String ownerCode);

    List<QuestionInfoVO> getQuestionByQuestionnaireId(@Param("questionnaireId")Long questionnaireId);

    /**
     * 根据questionnaireId查询问卷信息列表
     *
     * @param questionnaireId
     * @return java.util.List<com.yonyou.cyxdms.basedata.service.entity.questionaire.CareQuestionVO>
     * @author dengqiang
     * @since 2019/10/11
     */
    List<CareQuestionVO> queryQuestionByCondition(@Param("questionIdList") List<Long> questionIdList, @Param("questionnaireId") Long questionnaireId);

    /**
     * 根据answerGroupId查询答案列表
     *
     * @param answerGroupId
     * @return java.util.List<com.yonyou.cyxdms.basedata.service.vo.questionaire.AnswerVO>
     * @author dengqiang
     * @since 2019/10/13
     */
    List<AnswerVO> queryAnswerList(@Param("answerGroupId")Long answerGroupId);

    /**
     * 根据问卷ID查询问卷
     *
     * @author ysj
     * @date 2019/11/13
     * @param questionnaireId
     * @return
     */
    List<QuestionVisitInfoVO> queryQuestionVisitInfo(@Param("questionnaireId")Long questionnaireId,@Param("appId")String appId,@Param("ownerCode")String ownerCode);

    /**
     * 根据答案组ID查询答案选项
     *
     * @param answerGroupId
     * @return
     */
    List<AnswerVisitUsedVO> queryAnswerVisitUsed(@Param("answerGroupId")Long answerGroupId);
}
